home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 1
/
PC World Interactive 1 - Nisan 1997.iso
/
nostalji
/
bbs
/
modem
/
sssw33ie.exe
/
SETUP.MST
< prev
next >
Wrap
Text File
|
1996-09-05
|
14KB
|
527 lines
'**************************************************************************
'* Install Script for SAPS Server 3.10
'**************************************************************************
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
CONST SW_SHOWMAXIMIZED=3
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST ASKFORREBOOT = 1100
CONST SHOWINSTALLPATH = 1200
CONST CDSERNB = 1300
CONST CDCOMPNAME = 1400
CONST TOOBIG = 6300
CONST BADPATH = 6400
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL WINDIR$
GLOBAL SYSINI$
GLOBAL CTLINI$
GLOBAL SYSOLD$
GLOBAL CTLOLD$
GLOBAL SAPSUSER$
GLOBAL RestoreIniFlag%
GLOBAL WINDRIVE$ ''Windows drive letter.
''CustInst list symbol names
GLOBAL APPNEEDS$ ''Option list costs per drive
GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
GLOBAL DESTSPACEOK$
''Install Dialog list symbol names
GLOBAL CHECKSTATES$
GLOBAL STATUSTEXT$
GLOBAL DRIVETEXT$
DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%,iShow%) AS INTEGER
DECLARE SUB InstallFiles
DECLARE SUB UpdateIniFiles
DECLARE SUB RestoreIniFiles
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE SUB RecalcSpaceNeeded
DECLARE SUB SetDriveStatus
INIT:
hWnd%=HwndFrame()
j%=ShowWindow(hWnd%,SW_SHOWMAXIMIZED)
SetTitle "SAPS for Windows Server Setup Program"
SetAbout "SpartaCom Asynchronous Port Sharing","Copyright (c) SpartaCom S.A. 1993-1994"
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "INSTALL.INF"
END IF
ReadInfFile szInf$
WINDIR$ = GetWindowsDir()
WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
DEST$=WINDRIVE$ + ":\SAPS"
SYSINI$ = "SYSTEM.INI"
SYSINIFILE$ = MakePath (WINDIR$,SYSINI$)
SYSOLD$ = "SYSOLD.INI"
CTLINI$ = "CONTROL.INI"
CTLOLD$ = "CTLOLD.INI"
RestoreIniFlag%=0
''Install list symbols for FCustinstDlgProc
CHECKSTATES$ = "CheckItemsState"
STATUSTEXT$ = "StatusItemsText"
DRIVETEXT$ = "DriveStatusText"
FOR i% = 1 TO 7 STEP 1
AddListItem DRIVETEXT$, ""
NEXT i%
ReplaceListItem DRIVETEXT$, 7, DEST$
''Disk cost list symbols
APPNEEDS$ = "AppNeeds"
EXTRACOSTS$ = "ExtraCosts"
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "0"
NEXT i%
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Le lecteur de Windows ('"+WinDrive$+"') est invalide.", "Diagnostic", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
SERIALNB:
SetSymbolValue "SAPSIniFile", "SPSRV.INI"
SetSymbolValue "IsServerInstall", "YES"
sz$ = UIStartDlg(CUIDLL$, CDSERNB, "FSerNbDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO SERIALNB
END IF
COMPNAME:
CompName$ = GetIniKeyString(SYSINIFILE$,"Network","ComputerName")
IF CompName$ = "" THEN
sz$ = UIStartDlg(CUIDLL$, CDCOMPNAME, "FCompNameDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO COMPNAME
END IF
END IF
SEARCHDESTPATH:
WinPath$ = GetWindowsDir()
SPSRV$ = MakePath(WINDIR$, "SPSRV.INI")
SAPSUSER$ = MakePath(WINDIR$, "SAPSUSER.INI")
IF DoesIniKeyExist(SAPSRV$, "SERVER", "WorkingDirectory") THEN
DIRDEST$ = GetIniKeyString(SAPSRV$, "SERVER", "WorkingDirectory")
IF IsDirWritable(DIRDEST$) THEN
DEST$=DIRDEST$
ReplaceListItem DRIVETEXT$, 7, DEST$
END IF
ELSEIF DoesIniKeyExist(SAPSUSER$, "SPORTMAN", "WorkingDirectory") THEN
DIRDEST$ = GetIniKeyString(SAPSUSER$, "SPORTMAN", "WorkingDirectory")
IF IsDirWritable(DIRDEST$) THEN
DEST$=DIRDEST$
ReplaceListItem DRIVETEXT$, 7, DEST$
END IF
END IF
SHOWINSTALL:
RecalcSpaceNeeded
SetDriveStatus
sz$ = UIStartDlg(CUIDLL$, SHOWINSTALLPATH, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
''Install only if it will fit.
IF DESTSPACEOK$ <> "YES" THEN
GOSUB TOOBIG
GOTO SHOWINSTALL
END IF
UIPop 1
GOTO INSTALL
ELSEIF sz$ = "PATH" THEN
GOSUB GETPATH
GOTO SHOWINSTALL
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO SERIALNB
ELSEIF sz$ = "REACTIVATE" THEN
RecalcSpaceNeeded
SetDriveStatus
GOTO SHOWINSTALL
ELSE
GOSUB ASKQUIT
GOTO SHOWINSTALL
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
NEWDEST$ = GetSymbolValue("EditTextOut")
IF IsDirWritable(NEWDEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
DEST$=NEWDEST$
''Truncate display if too long.
IF LEN(DEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 7, DEST$
END IF
ELSEIF sz$ = "REACTIVATE" THEN
RecalcSpaceNeeded
SetDriveStatus
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO GETPATH
END IF
RETURN
INSTALL:
InstallFiles
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
IF dlg% <> EXITSUCCESS THEN
'' Installation fails. Restore INI files
IF RestoreIniFlag% = 1 THEN
RestoreIniFiles
END IF
END IF
END
ERRQUIT:
i% = DoMsgBox("Les fichiers du programme d'installation ont ΘtΘ corrompus, contactez le service de support technique du produit !", "Message du programme d'installation", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
RecalcSpaceNeeded
SetDriveStatus
GOTO TOOBIG
END IF
UIPop 1
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
ASKREBOOT:
sz$ = UIStartDlg(CUIDLL$, ASKFORREBOOT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO ASKREBOOT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKREBOOT
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB InstallFiles STATIC
WINDIR$ = GetWindowsDir()
SYSINI$ = "SYSTEM.INI"
SYSINIFILE$ = MakePath(WINDIR$, SYSINI$)
WinSysDir$ = GetWindowsSysDir()
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
WriteToLogFile "SAPS Server Installation"
WriteToLogFile "-------------------------"
WriteToLogFile "Destination Path : '" + DEST$ + "'"
WriteToLogFile ""
WriteToLogFile ""
ClearCopyList
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "System_Files", SrcDir$, WinSysDir$
SetRestartDir DEST$
CopyFilesInCopyList
'' Modif RQ 01/08/96 - Delete old CPLSAPS.DLL if found in the system directory
RemoveFile MakePath(WinSysDir$, "CPLSAPS.DLL"), cmoForce
SPSRV$ = MakePath(WINDIR$, "SPSRV.INI")
SAPSUSER$ = MakePath(WINDIR$, "SAPSUSER.INI")
CreateIniKeyValue SPSRV$, "SERVER", "WorkingDirectory", DEST$, cmoOverwrite
CreateIniKeyValue SPSRV$, "SERVER", "Visible", "1", cmoOverwrite
IF DoesIniSectionExist(SAPSUSER$, "SPORTMAN") THEN
CreateIniKeyValue SAPSUSER$, "SPORTMAN", "Server", "1", cmoOverwrite
END IF
CursorSave% = ShowWaitCursor()
UpdateIniFiles
CreateProgmanGroup "SAPS", "" , cmoNone
ShowProgmanGroup "SAPS", 1 , cmoNone
CreateProgmanItem "SAPS", "SAPS Server", MakePath(DEST$, "SPSRV.EXE"), "", cmoOverwrite
CreateProgmanItem "SAPS", "Server Help", MakePath(WinDir$, "WINHELP.EXE "+MakePath(DEST$, "SPSRV.HLP")), "", cmoOverwrite
CreateProgmanItem "SAPS", "Info", MakePath(WinDir$, "WRITE.EXE "+MakePath(DEST$, "INFO.WRI")), "", cmoOverwrite
RestoreCursor CursorSave%
CloseLogFile
END SUB
'**
'** Purpose:
'** Save .INI files to .OLD and Update .INI files
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB UpdateIniFiles STATIC
WINDIR$ = GetWindowsDir()
SYSINI$ = "SYSTEM.INI"
SYSINIFILE$ = MakePath(WINDIR$, SYSINI$)
WinSysDir$ = GetWindowsSysDir()
CTLINIFILE$ = MakePath(WINDIR$, CTLINI$)
CopyFile SYSINIFILE$, MakePath(DEST$, SYSOLD$), cmoOverwrite+cmoReadOnly, 0
CopyFile CTLINIFILE$, MakePath(DEST$, CTLOLD$), cmoOverwrite+cmoReadOnly, 0
CreateIniKeyValue CTLINIFILE$, "mmcpl", "SAPSServer", MakePath(DEST$, "WRAP16.DLL"), cmoOverwrite
NETHEAP$ = GetIniKeyString(SYSINIFILE$, "386Enh", "NetHeapsize")
IF VAL(NETHEAP$) < 28 THEN
CreateIniKeyValue SYSINIFILE$, "386Enh", "NetHeapSize", "28", cmoOverwrite
END IF
IF DoesIniSectionExist(SYSINIFILE$, "Standard") THEN
NETHEAP$ = GetIniKeyString(SYSINIFILE$, "Standard", "NetHeapSize")
IF VAL(NETHEAP$) < 28 THEN
CreateIniKeyValue SYSINIFILE$, "Standard", "NetHeapSize", "28", cmoOverwrite
END IF
END IF
RestoreIniFlag% =1
END SUB
'**
'** Purpose:
'** Restore .INI files to previous contents
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB RestoreIniFiles STATIC
WinSysDir$ = GetWindowsSysDir()
CopyFile MakePath(DEST$, SYSOLD$), MakePath(WINDIR$, SYSINI$), cmoOverwrite, 0
CopyFile MakePath(DEST$, CTLOLD$), MakePath(WINDIR$, CTLINI$), cmoOverwrite, 0
RemoveFile MakePath(DEST$, SYSOLD$), cmoForce
RemoveFile MakePath(DEST$, CTLOLD$), cmoForce
RestoreIniFlag% = 0
END SUB
'**
'** Purpose:
'** Recalculates disk space for the given option files and sets
'** the status info symbol "StatusItemsText".
'** Arguments:
'** none
'** Returns:
'** none.
'*************************************************************************
SUB RecalcSpaceNeeded STATIC
CursorSave% = ShowWaitCursor()
WinSysDir$ = GetWindowsSysDir()
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ClearCopyList
AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "System_Files", SrcDir$, WinSysDir$
dstdrive$ = MID$(DEST$, 1, 1)
wdrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
ndrive% = ASC(ucase$(dstdrive$)) - ASC("A") + 1
cost& = GetSizeOfFile(MakePath(WINDIR$, CTLINI$))
cost& = cost&+GetSizeOfFile(MakePath(WINDIR$, SYSINI$))
IF dstdrive$ = WINDRIVE$ THEN
''Add all extra cost to destination drive
ReplaceListItem EXTRACOSTS$, ndrive%, STR$(cost&+11264)
ELSE
''Add extra cost to Windows drive for ini/progman, etc.
ReplaceListItem EXTRACOSTS$, ndrive%, STR$(cost&)
ReplaceListItem EXTRACOSTS$, wdrive%, "11264"
END IF
StillNeed& = GetCopyListCost(EXTRACOSTS$, APPNEEDS$, "")
IF StillNeed& > 0 THEN
DESTSPACEOK$ = "NO"
ELSE
DESTSPACEOK$ = "YES"
END IF
RestoreCursor CursorSave%
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION
'**
'** Purpose:
'** Sets drive status info according to latest disk space calcs.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB SetDriveStatus STATIC
drive$ = MID$(DEST$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
free& = GetFreeSpaceForDrive(drive$)
ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " Kb"
ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " Kb"
IF drive$ = WINDRIVE$ THEN
ReplaceListItem DRIVETEXT$, 4, ""
ReplaceListItem DRIVETEXT$, 5, ""
ReplaceListItem DRIVETEXT$, 6, ""
ELSE
ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
IF cost& = 0 THEN
ReplaceListItem DRIVETEXT$, 4, ""
ReplaceListItem DRIVETEXT$, 5, ""
ReplaceListItem DRIVETEXT$, 6, ""
ELSE
free& = GetFreeSpaceForDrive(WINDRIVE$)
ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " Kb"
ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " Kb"
END IF
END IF
END SUB